package com.example.san.logactivity;

import android.app.Activity;
import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.Button;

public class MainActivity extends Activity {
    private Button myButton;
    static final String TAG = "MainActivity";

    @Override
    protected void onDestroy() {
        Log.v(MainActivity.TAG,"FirstAcvity ---> onDestory");
        super.onDestroy();
    }

    @Override
    protected void onPause(){
        Log.v(MainActivity.TAG,"FirstAcvity ---> onPause");
        super.onPause();
    }

    @Override
    protected void onRestart(){
        Log.v(MainActivity.TAG,"FirstAcvity ---> onRestart");
        super.onRestart();
    }

    @Override
    protected void onResume(){
        Log.v(MainActivity.TAG,"FirstAcvity ---> onResume");
        super.onResume();
    }

    @Override
    protected void onStart(){
        Log.v(MainActivity.TAG,"FirstAcvity ---> onStart");
        super.onStart();
    }

    @Override
    protected void onStop(){
        Log.v(MainActivity.TAG,"FirstAcvity ---> onStop");
        super.onStop();
    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        Log.v(TAG,"FirstAcvity ---> onCreate");
        myButton = (Button) findViewById(R.id.myButton);
        myButton.setText("启动第二个Activity");
        myButton.setOnClickListener(new View.OnClickListener(){
            @Override
            public void onClick(View v) {
                Intent intent =new Intent();
                intent.setClass(MainActivity.this,Main3Activity.class);
                MainActivity.this.startActivity(intent);
            }
        }
    );

}}
